s=input("Введите строку:")
s1=''
s2=''
a=0
for i in range(len(s)):
    si=s[i]
    if si in "{[<(":
        s2=s2+si
    elif si in "}]>)":
        if len(s2)==0:
            a+=1
            break
        else:
            if(si=='}' and s2[-1]=='{') or  (si==']' and s2[-1]=='[') or  (si==')' and s2[-1]=='(') or  (si=='>' and s2[-1]=='<'):
                s2=s2[:-1]
            else:
                a+=1
                break
if len(s2)==0 and a==0:
    print("True")
else:
    print("False")